Ext.define('Admin.view.post.PostAddForm', {
    extend: 'Ext.form.Panel',
    alias: 'widget.postAddForm',
    requires: [
    'Ext.form.field.ComboBox'
    ],
    viewModel: {type: 'postViewModel'},
    controller: 'postViewController',
    //cls: '',

    layout: {
        type:'vbox',
        align:'stretch'
    },

    bodyPadding: 10,
    scrollable: true,

    defaults: {
        labelWidth: 60,
        labelSeparator: ''
    },

    items: [{
              xtype:'combobox',
              allowBlank: false,
              fieldLabel: '部门',
               store:{
                         proxy: {
                         type: 'ajax',
                          url:'part/findAll',
                           reader: {
                          type: 'json',
                          rootProperty: 'lists'
                          }
                        },
                         fields: [ 'partId', 'partName']
                      },
              displayField: 'partName',
              valueField: 'partId',
              name:'part.partId',
              emptyText: '请选择...',
              blankText: '请选择部门',
              Addable: false,
              mode: 'local' 
     },{
        xtype: 'textfield',
        fieldLabel: '岗位名称',
        name:'postName'
    },{
        xtype: 'textfield',
        fieldLabel: '基本薪资',
        name:'basicSalary'
    },{
        xtype: 'textfield',
        fieldLabel: '所需人数',
        name:'requiredNum'
    }],

    bbar: {
        overflowHandler: 'menu',
        items: ['->',{
            xtype: 'button',
            ui: 'soft-green',
            text: '提交',
            handler : 'submitAddForm'
        },{
            xtype: 'button',
            ui: 'soft-red',
            text: '取消',
          handler :function(bt){
            var win = bt.up('window');
            if (win) {
                win.close();
            }
          }
        },'->']
    }
});